part of my_base_lib;
/// 自定义的事件总线

mixin EventBus{
  static List<EventBus> ebList =[];

  registerEventBus(){
    if(!ebList.contains(this)){
      ebList.add(this);
    }
  }

  unregisterEventBus(){
    if(ebList.contains(this)){
      ebList.remove(this);
    }
  }

  onEvent(EventInfo eventInfo){

  }

  static postEvent(EventInfo eventInfo){
    for (var element in ebList) {
      element.onEvent(eventInfo);
    }
  }
}

class EventInfo{
  late EventType type;
  dynamic eventObject;

  EventInfo(this.type,{this.eventObject});

}

enum EventType{
  resetPass,
  changeChatMode,
  updateMessageHistoryListEnd,
  notLogin,
  myAvagiInfoIsUpdated,
  //上传了自义定形象
  avagiImageIsUpload,
  bbb
}
